//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    class OleItem : IOfficeXmlSerializable
    {
        string _name;
        Boolean _icon;
        Boolean _advise;
        Boolean _preferPic;
        private const string xmlName = "oleItem";

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read(xmlName))
            {
                _name = c.GetString("name");
                _icon = c.GetOptionalBoolean("icon", false);
                _advise = c.GetOptionalBoolean("advise", false);
                _preferPic = c.GetOptionalBoolean("preferPic", false);
            }
        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write(xmlName))
            {
                c.SetString("name", _name);
                c.SetOptionalBoolean("icon", _icon, false);
                c.SetOptionalBoolean("advise", _advise, false);
                c.SetOptionalBoolean("preferPic", _preferPic, false);
            }
        }
    }
}